@extends('admin.layout.index')
@section('content')

@if (count($errors) > 0)
    <div class="mws-form-message error">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
     </div>
@endif
<div class="portlet box blue">
  <div class="portlet-title">
    <div class="caption">
      <i class="icon-reorder"></i>{{$title}}</div>
    <div class="tools">
      <a href="javascript:;" class="collapse"></a>
      <a href="#portlet-config" data-toggle="modal" class="config"></a>
      <a href="javascript:;" class="reload"></a>
      <a href="javascript:;" class="remove"></a>
    </div>
  </div>
  <div class="portlet-body form">
    <!-- BEGIN FORM-->
    <form action="/admin/config" class="form-horizontal" method="post">
    	{{ csrf_field() }}
      
      <div class="control-group">
        <label class="control-label">标题</label>
        <div class="controls">
          <input type="text" name="title" value="{{old('title')}}">
        </div>
      </div>

      <div class="control-group">
        <label class="control-label">名称</label>
        <div class="controls">
          <input type="text" name="name" value="{{old('name')}}">
        </div>
      </div>

      <div class="control-group">
        <label class="control-label">类型</label>
        <div class="controls">
          <td>
            <input type="radio" name="type" value="input" checked onclick="showTr(this)">input　
            <input type="radio" name="type" value="textarea" onclick="showTr(this)">textarea　
            <input type="radio" name="type" value="radio" onclick="showTr(this)">radio
          </td>
        </div>
      </div>

      <div class="control-group" id="htype" style="display:none">
        <label class="control-label ">类型值</label>
        <div class="controls">
          <input type="text" name="value">
          <span><i class="fa fa-exclamation-circle yellow"></i>格式 1|开启,0|关闭</span>
        </div>
      </div>

      <div class="control-group">
        <label class="control-label">说明</label>
        <div class="controls">
           <textarea name="tips" class="lg">{{old('tips')}}</textarea>
        </div>
      </div>

      <div class="control-group">
        <label class="control-label">内容</label>
        <div class="controls">
           <input type="text" name="content" value="{{old('content')}}">
        </div>
      </div>

       <div class="control-group">
        <label class="control-label">排序</label>
        <div class="controls">
           <input type="text" class="sm" name="order" value="{{old('order')}}">
        </div>
      </div>


      <div class="form-actions">
        <button type="submit" class="btn blue">添加</button>
      </div>
    </form>
    <!-- END FORM-->
    </div>
</div>    

<script>

    function showTr(obj){
       var ele_type =  $(obj).val();
       if(ele_type == 'radio'){
           $('#htype').show();
       }else{
           $('#htype').hide();
       }
    }

</script> 
@endsection